# -*- coding: utf-8 -*-
# 定时任务
import tushare as ts
import logging

logger = logging.getLogger("django")


def getTodayAll():
    try:
        return ts.get_today_all().to_json(orient='records')
    except Exception as e:
        logger.error("获取全部实时数据时异常%s", e.message)


# 获取实时分笔
def get_realtime_quotes(codes):
    return ts.get_realtime_quotes(str(codes).split(",")).to_json(orient='records')


# 一次性获取最近一个日交易日所有股票的交易数据
def get_today_all():
    return ts.get_today_all().to_json(orient='records')


# 获取大盘指数行情
def get_index():
    return ts.get_index().to_json(orient='records')
